package com.example.speeddating.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.speeddating.entity.Blacklist;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

/**
 *
 * @author tina
 * @since 2023-08-14 10:32:59
 */
@Mapper
public interface BlacklistMapper extends BaseMapper<Blacklist> {

    @Results({
            @Result(column = "id", property = "id"),
            @Result(column = "user_id", property = "userId"),
            @Result(column = "black_user_id", property = "blackUserId"),
            @Result(column = "user_id",property = "user",
                    one = @One(select = "com.example.speeddating.mapper.UserMapper.selectUser")),
            @Result(column = "black_user_id", property = "blackUser",
                    one = @One(select = "com.example.speeddating.mapper.UserMapper.selectUser")),
    })
    @Select("select * from blacklist where deleted = 0 AND user_id=#{id}")
    Page<Blacklist> selectBlackList(Page<Blacklist> page, Long id);
}
